
import com.aetrion.flickr.Flickr;
import com.aetrion.flickr.REST;
import com.aetrion.flickr.photos.SearchParameters;
import com.aetrion.flickr.photos.PhotoList;
import com.aetrion.flickr.photos.PhotosInterface;
import com.aetrion.flickr.photos.Photo;
	
public class FlickrImageFinder {
        
        
        public static void main(String[] args) throws Exception{
                FlickrImageFinder finder = new FlickrImageFinder();
                finder.getImages();
        }
        
        public void getImages() throws Exception {

                                
            String key="e700db8c46d0b2f013c306df4ebacbb2";
            String svr="www.flickr.com";
            REST rest = new REST();
            rest.setHost(svr);     
                    
            Flickr flickr=new Flickr(key, rest);
            flickr.setSharedSecret("245133619a02aa48");
            Flickr.debugStream=false;
            
            SearchParameters searchParams=new SearchParameters();
            searchParams.setSort(SearchParameters.INTERESTINGNESS_DESC);
                    
            //String[] tags=new String[]{"Ecuador","Correa"};
            //searchParams.setTags(tags);
            
            String [] t = {"Lobo","Animal"};
            searchParams.setTags(t);
           

            //Initialize PhotosInterface object
            PhotosInterface photosInterface=flickr.getPhotosInterface();
            //Execute search with entered tags
            PhotoList photoList=photosInterface.search(searchParams,20,1);

            StringBuffer strBuf=new StringBuffer();                        
                    
            if(photoList!=null){          
               for(int i=0;i<photoList.size();i++){         
                  Photo photo=(Photo)photoList.get(i);                          
                  //strBuf.append("<img border=\"0\" src=\""+photo.getThumbnailUrl()+"\">\n");
                  //strBuf.append(""+photo.getLargeUrl()+"\n"); Direccion Url de la imagen
                  strBuf.append(""+photo.getTags()+"\n");
               }
               
               System.out.println(strBuf.toString());                  
            }           
        }       
}